import { keys, each, isEmpty, isNumber } from 'lodash'

const removeParamsNullValue = (data = {}) => {
  if (isEmpty(data)) {
    return data
  }
  const keyList = keys(data)
  const newData = {}
  each(keyList, item => {
    if (isNumber(data[item]) || !isEmpty(data[item])) {
      newData[item] = data[item]
    }
  })

  return newData
}

export default removeParamsNullValue
